package guda.house.dal.dao.impl;

import guda.grape.autogen.common.BaseDAO;
import guda.house.dal.dao.WxPayOrderDAO;
import guda.house.dal.dataobject.WxPayOrderDO;
import guda.grape.autogen.common.page.BaseQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WxPayOrderDAOImpl extends BaseDAO implements WxPayOrderDAO {

    @Override
	public Long insert(WxPayOrderDO wxPayOrder) {
	      try {
                return (Long) getSqlMapperW().insert("wx_pay_order.insert",wxPayOrder);
          } catch (Exception e) {
                throw new RuntimeException(e);
          }

	}

    @Override
	public WxPayOrderDO getWxPayOrderById(Long orderId) {
	    return (WxPayOrderDO)getSqlMapClientTemplate().queryForObject("wx_pay_order.getWxPayOrderById", orderId);
	}

    @Override
	public boolean delWxPayOrderById(Long orderId) {
	    int num = 0;
        try {
            num = getSqlMapperW().delete("wx_pay_order.delWxPayOrderById",orderId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        if(num>0){
            return true;
        }else{
            return false;
        }
	}

    @Override
	public List<WxPayOrderDO> getWxPayOrderByIds(List idsList) {
        Map m = new HashMap();
        m.put("idsList",idsList);
		return getSqlMapClientTemplate().queryForList("wx_pay_order.selectByIds", m);
	}

    @Override
	public void cleanAutoIncrement(Long orderId) {
	    try {
            getSqlMapperW().update("wx_pay_order.cleanAutoIncrement",orderId);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
	}

    @Override
    public List<WxPayOrderDO> selectForPage(BaseQuery baseQuery) {
        return getSqlMapClientTemplate().queryForList("wx_pay_order.selectForPage", baseQuery);
    }

    @Override
    public int countForPage(BaseQuery baseQuery) {
        return (Integer)getSqlMapClientTemplate().queryForObject("wx_pay_order.countForPage",baseQuery);
    }

    @Override
    public void updateByIdSelective(WxPayOrderDO wxPayOrder) {
        try {
            getSqlMapperW().update("wx_pay_order.updateByIdSelective",wxPayOrder);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public WxPayOrderDO getWxPayOrderByOrderNo(String orderNo) {
        return (WxPayOrderDO)getSqlMapClientTemplate().queryForObject("wx_pay_order.getWxPayOrderByOrderNo", orderNo);
    }

}

